import img404 from '@$@/img/img404.gif';
import $app from '../../$app';


//大类型分类
let bigEachCol={
  zeroXu(that,width) {
    let out = {
      title: " ",
      className: `f_14 goOnTxt c999  ${!that.isHome && ` padding5-0`}`,
      width: width || 30,
      type:'index',
      align:'center'
    }
    return out;
  },

  zeroA(that,width) {
    let out = {
      title: "商品",
      width: width,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      key:'goods_name'
    };
    return out;
  },
  zeroB(that,width) {
    let out = {
      title: "类型",
      maxWidth: width || 150,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            order_type,
            goods_type
          }
        } = params;
        let out = h(
          "span",
          { class: " " },
          `${$app.orderTypeSwitch(order_type,goods_type)}`
        );


        return out;
      }
    };
    return out;
  },

  zeroC(that,width) {
    let out = {
      title: "官费 + 服务费",
      maxWidth: width || 200,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            order_money,
            official_fee,
            service_fee,
          }
        } = params;

        return h("div", [
          h(
            "div",
            { class: " cRed " },
            `¥ ${parseFloat(order_money)} `
          ),
          h(
            "div",
            { class: " " },
            `( ${parseFloat(official_fee)} + ${parseFloat(service_fee)} )`
          )
        ]);
      }

      // render: (h, params) => {
      //   let {
      //     row: {
      //       order_money,
      //       official_fee,
      //       service_fee,
      //     }
      //   } = params;

      //   return h(
      //     "span",
      //     { class: " " },
      //     `${parseFloat(order_money)}（${parseFloat(official_fee)}+${parseFloat(service_fee)})`
      //   );
      // }
    };
    return out;
  },
  zeroD(that,width) {
    let out = {
      title: "订单编号",
      maxWidth: width||230,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      key:'order_no'
    };
    return out;
  },
  zeroE(that,width) {
    
    let out = {
      title: "下单时间",
      maxWidth: width || 150,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      key:'created_at',
      sortable: 'custom',//如果设置为 custom，则代表用户希望远程排序
      sortType:that.order_sort,
      render: (h, params) => {
        let {
          row: {
            created_at
          }
        } = params;

        created_at=created_at.toString().slice(0,16);


        return h("span", {},created_at);
      }
    };
    return out;
  },
  zeroF(that,width) {
    let out = {
      title: "订单状态",
      width: width || 120,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            state_name
          }
        } = params;
        return h("span", { class: " cRed" }, `${state_name}`);
      }
    };
    return out;
  },
  zeroG(that,width) {
    let out = {
      title: "专利名称",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: $app.isMinScreen()?150:width,
      render: (h, params) => {
        let {
          row: {
            patent_info: {
              name
            }
          }
        } = params;
        return h("span", { class:""}, `${name}`);
      }
    };
    return out;
  },
  zeroH(that,width) {
    let out = {
      title: "专利号",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: $app.isMinScreen()?100:width,
      render: (h, params) => {
        let {
          row: {
            patent_info: {
              name, patent_number
            }
          }
        } = params;

        let hasNum = $app.judgeData(patent_number);
        return h("span", { class: " " }, `${hasNum ? patent_number : ' '}`);
      }
    };
    return out;
  },
  zeroI(that,width) {
    let out = {
      title: "申请人",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width,
      render: (h, params) => {
        let {
          row: {
            patent_info: {
              applicant_name_list
            }
          }
        } = params;
        // console.log(params.row.patent_info)

        return h("span", { class: " " }, `${applicant_name_list}`);
      }
    };
    return out;
  },
  zeroJ(that,width) {
    let out = {
      title: "发明人",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width || 100,
      render: (h, params) => {
        let {
          row: {
            patent_info: {
              inventor_name_list
            }
          }
        } = params;
        // console.log(params.row.patent_info)

        return h("span", { class: " " }, `${inventor_name_list}`);
      }
    };
    return out;
  },
  zeroK(that,width) {
    let out = {
      title: "专利订单状态",
      maxWidth: width || 150,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            state_name,
            patent_info
          }
        } = params;
        return h("span", { class: " cRed" }, `${$app.judgeData(patent_info)?patent_info.state_name:state_name}`);
      }
    };
    return out;
  },
  zeroL(that,width) {
    let out = {
      title: "图样",
      align: "center",
      width: width || 100,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            trademark_info: {
              img_path
            }
          }
        } = params;


        return h("div", [
          h("img", {
            class: `f_12 contain inlineBlock padding5 pointer`,
            style: {
              width: `${that.isHome ? `50px` : `80px`}`,
              height: `${that.isHome ? `40px` : `60px`}`,
            },
            attrs: {
              src: img_path
            },
            on: {
              error: (event) => {
                event.target.src = img404;
              },
              click:()=>{
                $app.imgBoxSee(event.target.src);
              }
            }
          })
        ]);
      }
    };
    return out;
  },
  zeroM(that,width) {
    let out = {
      title: "商标名称",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width,
      render: (h, params) => {
        let {
          row: {
            goods_name,
            trademark_info: {
              name, apply_number
            }
          }
        } = params;

        return h("span", { class: `  cBlue` }, `${name}`);
      }
    };
    return out;
  },
  zeroN(that,width) {
    let out = {
      title: "申请人",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width,
      render: (h, params) => {
        let {
          row: {
            trademark_info: {
              reg_people_name, reg_people_type,
            }
          }
        } = params;


        let lX = '';
        switch (parseInt(reg_people_type)) {
          case (1):
            lX = '企业';
            break;
          case (2):
            lX = '个体工商户';
            break;
        };


        return h("span", { class: " " }, `${reg_people_name}`);
      }
    };
    return out;
  },
  zeroO(that,width) {
    let out = {
      title: "申请人类型",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width || 100,
      render: (h, params) => {
        let {
          row: {
            trademark_info: {
              reg_people_name, reg_people_type,
            }
          }
        } = params;


        let lX = '';
        switch (parseInt(reg_people_type)) {
          case (1):
            lX = '企业';
            break;
          case (2):
            lX = '个体工商户';
            break;
        };


        return h("span", { class: " " }, `${lX}`);
      }
      
    };
    return out;
  },
  zeroR(that,width) {
    let out = {
      title: "商标订单状态",
      maxWidth: width || 150,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            state_name,
            trademark_info
          }
        } = params;
        return h("span", { class: "cRed" }, `${$app.judgeData(trademark_info)?trademark_info.state_name:state_name}`);
      }
    };
    return out;
  },
  zeroS(that,width) {
    let out = {
      title: "版权名称",
      width: width || 150,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {

        //判断订单状态，显示不同按钮
        let {
          row: {
            order_type,
          }
        } = params, out = '';

        if (order_type != 10) {
          out = h("span", { class: " " }, `${$app.copyright_SW(params).bigName}`);
        }
        return out;
      }
    };
    return out;
  },
  zeroT(that,width) {
    let out = {
      title: "申请人",
      width: width,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {

        //判断订单状态，显示不同按钮
        let {
          row: {
            order_type,
          }
        } = params, out = '';

        if (order_type != 10) {
          out = h("span", { class: " " }, `${$app.copyright_SW(params).people_name}`);
        }
        return out;
      }
    };
    return out;
  },
  zeroU(that,width) {
    let out = {
      title: "版权订单状态",
      width: width||130,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        //判断订单状态，显示不同按钮
        let {
          row: {
            order_type,
          }
        } = params, out = '';

        if (order_type != 10) {
          out = h("span", { class: "  cRed" }, `${$app.copyright_SW(params).state_name}`)
        } else {
          out = h("span", { class: "  cRed" }, `${params.row.state_name}`)
        }
        return out;
      }
    };
    return out;
  },
  zeroV(that,width) {
    let out = {
      title: "商标名称",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width||150,
      render: (h, params) => {

        let {
          row: {
            tm_report: {
              tm_name, tm_type, id
            }
          }
        } = params;

        return h("span", { class: " " }, `${tm_name}`);
      }
    };
    return out;
  },
  zeroW(that,width) {
    let out = {
      title: "类别",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width||150,
      render: (h, params) => {

        let {
          row: {
            tm_report: {
              tm_name, tm_type, id
            }
          }
        } = params;

        return h("span", { class: " " }, `第${tm_type}类`);
      }
    };
    return out;
  },































  baseA(that,width) {
    let out = {
      title: "商品 / 类型",
      width: width || 350,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            order_type,
            goods_name
          }
        } = params;


        return h("div", [
          h("i", {
            class: `iconfont ${$app.orderTypeIcon(order_type)} cBlue f_35  pullLeft marginR20 `
          }),
          h("div", { class: "overflowH" }, [
            h(
              "div",
              { class: "lineH1d5  cBlue marginT5" },
              `${goods_name}`
            ),
            h(
              "div",
              { class: "lineH1d5 " },
              `${$app.orderTypeSwitch(order_type)}`
            )
          ])
        ]);
      }
    };
    return out;
  },
  baseB(that,width) {
    let out = {
      title: "金额（官费+服务费）",
      width: 200,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            order_money,
            official_fee,
            service_fee,
          }
        } = params;

        return h("div", [
          h(
            "div",
            { class: "lineH1d5  cRed" },
            `¥ ${parseFloat(order_money)} 元`
          ),
          h(
            "div",
            { class: "lineH1d5 " },
            `官: ${parseFloat(official_fee)}  服: ${parseFloat(service_fee)}`
          )
        ]);
      }
    };
    return out;
  },
  baseC(that,width) {
    let out = {
      title: "订单编号 / 下单时间",
      width: 200,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        return h("div", [
          h("div", {
            class: "lineH1d5  f_12 c999",
            attrs: {
              title: params.row.order_no
            },
          }, `${params.row.order_no}`),
          h("div", { class: "lineH1d5  f_12 c999" }, `${params.row.created_at}`)
        ]);
      }
    };
    return out;
  },
  baseD(that,width) {
    let out = {
      title: "订单状态",
      width: width || 250 ,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      align: "center",
      render: (h, params) => {
        return h("div", [
          h("div", { class: "lineH1d5  cRed" }, `${params.row.state_name}`)
        ]);
      }
    };
    return out;
  },
  baseE(that,width) {
    let out = {
      title: "专利名称 / 专利号",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width || 200,
      render: (h, params) => {
        let {
          row: {
            patent_info: {
              name, patent_number
            }
          }
        } = params;

        let hasNum = $app.judgeData(patent_number);
        return h("div", [
          h("div", { class: `lineH1d5 ` }, `${name}`),
          h("div", { class: `lineH1d5  ${!hasNum && ` cCCC`}` }, `${hasNum ? patent_number : ' '}`)
        ]);
      }
    };
    return out;
  },
  baseF(that,width) {
    let out = {
      title: "申请人 / 发明人",
      width: width || 140,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            patent_info: {
              applicant_name_list, inventor_name_list
            }
          }
        } = params;
        // console.log(params.row.patent_info)

        return h("div", [
          h("div", { class: "lineH1d5 " }, `${applicant_name_list}`),
          h("div", { class: "lineH1d5 " }, `${inventor_name_list}`)
        ]);
      }
    };
    return out;
  },
  baseH(that,width) {
    let out = {
      title: "商标名称 / 类型",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width || 200,
      render: (h, params) => {
        let {
          row: {
            goods_name,
            trademark_info: {
              name, apply_number
            }
          }
        } = params;

        return h("div", [
          h("div", { class: `lineH1d5  cBlue` }, `${name}`),
          h("div", { class: `lineH1d5 ` }, `${goods_name}`)
        ]);
      }
    };
    return out;
  },
  baseI(that,width) {
    let out = {
      title: "申请人 / 类型",
      width:250,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        let {
          row: {
            trademark_info: {
              reg_people_name, reg_people_type,
            }
          }
        } = params;


        let lX = '';
        switch (parseInt(reg_people_type)) {
          case (1):
            lX = '企业';
            break;
          case (2):
            lX = '个体工商户';
            break;
        };


        return h("div", [
          h("div", { class: "lineH1d5 " }, `${reg_people_name}`),
          h("div", { class: "lineH1d5 " }, `${lX}`)
        ]);
      }
    };
    return out;
  },
  baseK(that,width) {
    let out = {
      title: "图样",
      align: "center",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: 120,
      render: (h, params) => {
        let {
          row: {
            trademark_info: {
              img_path
            }
          }
        } = params;


        return h("div", [
          h("img", {
            class: `f_12 cover inlineBlock padding5`,
            style: {
              width: `${that.isHome ? `50px` : `80px`}`,
              height: `${that.isHome ? `50px` : `80px`}`,
            },
            attrs: {
              src: img_path
            },
            on: {
              error: (event) => {
                event.target.src = img404;
              }
            }
          })
        ]);
      }
    };
    return out;
  },
  baseL(that,width) {
    let out = {
      title: "版权名称 / 申请人",
      resizable:true,
      width: 200,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {

        //判断订单状态，显示不同按钮
        let {
          row: {
            order_type,
          }
        } = params, out = '';

        if (order_type != 10) {
          out = h("div", [
            h("div", { class: "lineH1d5 " }, `${$app.copyright_SW(params).bigName}`),
            h("div", { class: "lineH1d5 " }, `${$app.copyright_SW(params).people_name}`)
          ])
        }
        return out;
      }
    };
    return out;
  },
  baseM(that,width) {
    let out = {
      title: "版权订单状态",
      width: width||250,
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {
        //判断订单状态，显示不同按钮
        let {
          row: {
            order_type,
          }
        } = params, out = '';

        if (order_type != 10) {
          out = h("div", [
            h("div", { class: "lineH1d5  cRed" }, `${$app.copyright_SW(params).state_name}`)
          ])
        } else {
          out = h("div", [
            h("div", { class: "lineH1d5  cRed" }, `${params.row.state_name}`)
          ])
        }
        return out;
      }
    };
    return out;
  },
  baseO(that,width) {
    let out = {
      title: "商标名称 / 类别",
      resizable:true,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      width: width||300,
      render: (h, params) => {

        let {
          row: {
            tm_report: {
              tm_name, tm_type, id
            }
          }
        } = params;

        return h("div", [
          h("div", { class: "lineH1d5 " }, `${tm_name}`),
          h("div", { class: "lineH1d5 " }, `第${tm_type}类`)
        ]);
      }
    };
    return out;
  },
  baseBtn(that,width) {

    let out = {
      title: "操作",
      width:width||200,
      className: `f_14 goOnTxt ${!that.isHome && ` padding5-0`}`,
      render: (h, params) => {

        //判断订单状态，显示不同按钮
        let {
          row,
          row: {
            refund_at,//退款时间
            goods_type,
            order_type,//1专利申请,2商标注册,3版权订单(软著+美术作品),5商标分析报告,7服务大厅商标订单,8服务大厅专利订单,
            state,//订单状态,0已取消,1已下单,2已支付
            //pay_type//0未支付,1余额,2猫币,3微信扫码支付,4微信公众号支付
          }
        } = params, btnList = [];
        

       



        

        if (order_type == 9) {//9购买数量

          btnList.push(
            h(
              "span",
              {
                class: (" cBlue textLink f_bold marginR10 inlineBlock"),
                props: {
                  icon: "ios-search",
                  size: "small",
                  type: "primary"
                },
                on: {
                  click: () => {
                    that.$Modal.success({
                      render: () => {
                        let out=[
                          h(
                            "div",
                            {
                              class:"marginB20 f_16"
                            },
                            `备注：${row.remark}`
                          ),
                          h(
                            "div",
                            {
                              class:"f_16"
                            },
                            `数量：${row.num}`
                          )
                        ];
                        return out;
                      }
                    });
                  }
                }
              },
              `详情`
            )
          );
        } else if (order_type == 10) {
          //毛都不做
        } else if ((order_type != 5 && order_type != 6) || ((order_type == 5 || order_type == 6) && state == 2)) {

          
          //非单独的1元购买数量
          if(goods_type!=119){
            btnList.push(
              h(
                "span",
                {
                  class: (" cBlue textLink f_bold marginR10 inlineBlock"),
                  props: {
                    icon: "ios-search",
                    size: "small",
                    type: "primary"
                  },
                  on: {
                    click: () => {
                      that.goInfo(params);
                    }
                  }
                },
                `详情`
              )
            );
          }
        }
        

        if (state ==1 ) {//未付款
          if($app.judgeData(btnList)){
            btnList.push(
              h(
                "span",
                {
                  class: "marginR10 cCCC",
                  props: {
                    type: "primary",
                    icon: "logo-yen",
                    size: "small",
                    ghost: true
                  }
                },
                `|`
              )
            );
          }
          
          btnList.push(
            h(
              "span",
              {
                class: "marginR10 " + (" cRed textLink f_bold inlineBlock"),
                props: {
                  type: "primary",
                  icon: "logo-yen",
                  size: "small",
                  ghost: true
                },
                on: {
                  click: () => {
                    that.btnPay(row);
                  }
                }
              },
              `支付`
            ),
            h(
              "span",
              {
                class: "marginR10 cCCC",
                props: {
                  type: "primary",
                  icon: "logo-yen",
                  size: "small",
                  ghost: true
                }
              },
              `|`
            ),
            
            h(
              "span",
              {
                class: "marginR10 c999 pointer inlineBlock",
                props: {
                  icon: "ios-trash",
                  size: "small"
                },
                on: {
                  click: () => {
                    that.delOrderGo(row);
                  }
                }
              },
              `删除`
            )
          );
        }else{//已付款 或 已取消订单
          
          // 有专利详情
          if($app.judgeData(row.patent_info)){

            
            let judgeA=row.patent_info.write_patent_type>0;//大于0一定是撰写订单
            let judgeB=row.patent_info.write_only==0;//0撰写+代缴=要去补充资料，1纯撰写，无需补充资料
            let judgeC=(state==2);//已经付款
            let judgeD=!$app.judgeData(row.patent_info.inventor_name_list) && !$app.judgeData(row.patent_info.applicant_name_list)//没有申请人，也没有发明人
            let judgeE=$app.is103_108_132(goods_type);//订单类型满足这些
            
            //state==2 已经付款
            //write_only 1纯撰写不代交, 0撰写及代交
            if(judgeA && judgeB && judgeC && judgeD && judgeE){
              btnList.push(
                h(
                  "span",
                  {
                    class: "marginR10 cCCC",
                    props: {
                      type: "primary",
                      icon: "logo-yen",
                      size: "small",
                      ghost: true
                    }
                  },
                  `|`
                ),
                h(
                  "span",
                  {
                    class: (" cRed f_bold textLink  marginR10 inlineBlock"),
                    props: {
                      icon: "ios-search",
                      size: "small",
                      type: "primary"
                    },
                    on: {
                      click: () => {
                        that.tianXieBook(row);
                      }
                    }
                  },
                  `补充资料`
                )
              );
            }

          }

          

          if($app.judgeData(refund_at)){
            btnList.push(
              h(
                "span",
                {
                  class: "marginR10 cCCC",
                  props: {
                    type: "primary",
                    icon: "logo-yen",
                    size: "small",
                    ghost: true
                  }
                },
                `|`
              ),
              h(
                "span",
                {
                  class: (" c999 textLink  marginR10 inlineBlock"),
                  props: {
                    icon: "ios-search",
                    size: "small",
                    type: "primary"
                  },
                  on: {
                    click: () => {
                      that.tuiKuan(row);
                    }
                  }
                },
                `退款详情`
              )
            );
          }
        }


        return h("div", $app.judgeData(btnList) ? btnList : '-');
      }
    };


    return out;
  }



};

// 表格 列 配置
export default bigEachCol;